var uid = sessionStorage.getItem("u_group_no");
$(function () {
	 /* 获取订单类别的点击事件 */
	$("#category_select").on("change", function(){
		//订单类别
	 	var take_type = $(this).children('option:selected').val(); 
		GetPageData('获取订单列表', { "actName": "actPatient", "actTag": "Indent_list", "take_type": take_type, "group_no": uid }, getDDData)
	 });
    GetPageData('获取订单列表', { "actName": "actPatient", "actTag": "Indent_list", "take_type": 0, "group_no": uid }, getDDData);
	
	/* 订单列表详情点击 */
	$("#shop_order_list").on("click", ".order-details", function(){
		var prescription_id = $(this).attr("data-Pid");
		var indent_no = $(this).attr("data-Iid")
		
		window.location.href = "shop_order_details.html?prescription_id=" + prescription_id + "&indent_no=" + indent_no
	});
	
});

/* 获取处方信息 */
function getDDData(rstData) {
	if (rstData.total > 0) {
		//生成html片段
		var html = template("shopOrderList",rstData);
		var container = document.getElementById("shop_order_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
	else{
		//生成html片段
		var html = template("noData",rstData);
		var container = document.getElementById("shop_order_list");
		//将html片段渲染到界面中
		container.innerHTML = html;
	}
}